<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>超时调用、简写调用</title>
  <script>
    

    console.log(id1);
    // 清除超时调用
    clearTimeout(id1);

    // 间歇调用
    var id2 = setInterval(function() {
      console.log('间歇调用');
    }, 1000)

    var id1 = setTimeout(function() {
      console.log('超时调用');
      // 清除间歇调用
      clearInterval(id2)
    },5000)

  </script>
</head>
<body>
  超时调用
</body>
</html>